# # 第一步导入时间操作库
# import time
# #第二步 导入selenium测试工具和wdbdriver库
# from selenium import webdriver
# from selenium.webdriver import ActionChains
# from selenium.webdriver.common.by import By
#
# # 第三步 创建驱动对象
# wzt = webdriver.Edge()
# # 打开网页https://shop.aircheng.com/simple/login
# wzt.get('https://shop.aircheng.com/simple/login')
# # 创建鼠标操作对象
# a = ActionChains(wzt)
# # 鼠标悬停全部商品
# b = wzt.find_element(By.CSS_SELECTOR,'body > header > div.nav_bar > div > div > div.category_list > a > h3')
# a.move_to_element(b)
# a.perform()
# # 点击生活电器
# c = wzt.find_element(By.XPATH,'/html/body/header/div[2]/div/div/div[1]/ul/li[1]/div[1]/a[2]')
# a.click(c)
# a.perform()
# # 进入页面后,鼠标悬停到全部商品
# b = wzt.find_element(By.CSS_SELECTOR,'body > header > div.nav_bar > div > div > div.category_list > a > h3')
# a.move_to_element(b)
# a.perform()
# # 点击玩具
# d = wzt.find_element(By.XPATH,'/html/body/header/div[2]/div/div/div[1]/ul/li[5]/div[1]/a[3]')
# a.click(d)
# a.perform()
# # 进入页面后,点击第一个玩具
# time.sleep(3)
# e = wzt.find_element(By.XPATH,'/html/body/div[3]/div/section[2]/section/section/ul/li[1]/a/img')
# a.click(e)
# a.perform()
# # 关闭网页
# time.sleep(100)
# wzt.quit()
import time
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By

# 创建驱动对象
ele = webdriver.Edge()
# 最大窗口命令
ele.maximize_window()
# 打开网页
ele.get('https://www.baidu.com/?tn=85070231_5_hao_pg')
# 创建鼠标
s = ActionChains(ele)
# 在输入框输入'周杰伦'
ele.find_element(By.CSS_SELECTOR,'#kw').send_keys('周杰伦')
time.sleep(3)
# 点击百度一下,查询相关信息
ele1 = ele.find_element(By.CSS_SELECTOR,'#su')
s.click(ele1)
s.perform()
time.sleep(3)
# 点击结果的第一条信息
ele2 = ele.find_element(By.XPATH,'//*[@id="4"]/div/div/h3/a')
s.click(ele2)
s.perform()
# 设置运行时间
time.sleep(100)
ele.quit()
